/*
 * This file is part of Catfish.
 * Copyright (C) 2010 Namazu Studios LLC
 * 
 * Catfish is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of 
 * the License, or (at your option) any later version.
 * 
 * Catfish is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with Catfish.  If not, please visit:
 *  
 * http://www.gnu.org/licenses/
 *  
 */
package com.namazustudios.catfish.provider;


/**
 * The default provider. For numberic types (char,short, int, long, float,
 * double) it sets the value to zero. For Object types it returns null.
 * 
 * @author patricktwohig
 * 
 */
public class DefaultValueProvider implements ValueProvider<Object> {

	@Override
	public Object provide(Class<? extends Object> type) {
		if (Byte.class.equals(type)) {
			return 0;
		} else if (Character.class.equals(type)) {
			return 0;
		} else if (Short.class.equals(type)) {
			return 0;
		} else if (Integer.class.equals(type)) {
			return 0;
		} else if (Long.class.equals(type)) {
			return 0;
		} else if (Float.class.equals(type)) {
			return 0f;
		} else if (Double.class.equals(type)) {
			return 0d;
		} else if (Boolean.class.equals(type)) {
		    return false;
	    } else if (byte.class.equals(type)) {
            return 0;
        } else if (char.class.equals(type)) {
            return 0;
        } else if (short.class.equals(type)) {
            return 0;
        } else if (int.class.equals(type)) {
            return 0;
        } else if (long.class.equals(type)) {
            return 0;
        } else if (float.class.equals(type)) {
            return 0f;
        } else if (double.class.equals(type)) {
            return 0d;
        } else if (boolean.class.equals(type)) {
            return false;
        } else {
            return null;
        }
	}
}
